package school.valon;

import org.springframework.beans.BeanUtils;

import school.valon.dto.UserDto;

public class UserContext {
	private static final ThreadLocal<UserDto> userDto
		= new ThreadLocal<UserDto>() {
        @Override
        protected UserDto initialValue() {
            return new UserDto();
        }
	};

	public static UserDto getCurrentUser() {
		return userDto.get();
	}

	public static void setUser(UserDto userDto) {
		BeanUtils.copyProperties(userDto, getCurrentUser());
	}
}
